﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CompanyManageSystem.Model
{
    class PSContext : DbContext
    {
        public PSContext() : base("name=PSContext"){}

        public virtual DbSet<Company> Companys { get; set; }

        public virtual DbSet<CompanyStaffInfo> CompanyStaffInfos { get; set; }

        public virtual DbSet<Users> Users { get; set; }

        public virtual DbSet<Department> Departments { get; set; }

        public virtual DbSet<Login> Logins { get; set; }

        public virtual DbSet<Manager> Mangers { get; set; }

        public virtual DbSet<AToken> ATokens { get; set; }

        public virtual DbSet<WeiXinInfo> WeiXinInfos { get; set; }

        public virtual DbSet<Province> Provinces { get; set; }

        public virtual DbSet<Graduation> Graduations { get; set; }

        public virtual DbSet<BusinessNav> BusinessNavs { get; set; }

        public virtual DbSet<BaseElement> BaseElements { get; set; }

        public virtual DbSet<Supplier> Suppliers { get; set; }

        public virtual DbSet<Unit> Units { get; set; }

        public virtual DbSet<PurchaseOrderDetail> PurchaseOrderDetails { get; set; }
        
        public virtual DbSet<PurchaseStorageOrder> PurchaseStorageOrders { get; set; }

        public virtual DbSet<PurchaseStorageOrderDetail> PurchaseStorageOrderDetails { get; set; }

        public virtual DbSet<Material> Materials { get; set; }

        public virtual DbSet<Canteen> Canteens { get; set; }

        public virtual DbSet<Stall> Stalls { get; set; }

        public IQueryable<BaseElement> SuppliersCategorys { get { return BaseElements.Where(p => p.Category == 3).OrderBy(p => p.Code); } }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
        }

    }
}
